<?php
/**
 * File: logout.php
 * @author: CIS505 TEAM 1
 * @Version: 2012-11-29
 * Purpose: to destroy a session
 */
session_start();
require_once("util.php");

destroy_session_and_data();

function destroy_session_and_data( )
{
  $userID = $_SESSION['userID'];
  $userName = $_SESSION['userName'];

  $_SESSION = array( );
  if ((session_id) != "" || isset($_COOKIE[session_name()]))
    setcookie(session_name(), '', time() - 2592000, '/');
  session_destroy();
  exit(header("LOCATION:../index.php"));

}
?>